package system

import (
	"counter-help/admin/server/global"
	"time"
)

// UUIDLicense 结构体
type UUIDLicense struct {
	global.GVA_MODEL
	UUID             string    `json:"uuid" gorm:"comment:UUID;not null;unique"`
	ExpireTime       time.Time `json:"expireTime" gorm:"comment:过期时间" time_format:"2006-01-02 15:04:05"`
	IsActive         bool      `json:"isActive" gorm:"comment:是否激活;default:true"`
	Description      string    `json:"description" gorm:"comment:描述"`
	DailyAccessLimit int       `json:"dailyAccessLimit" gorm:"comment:每日访问限制次数;default:100"`
	CurrentDayAccess int       `json:"currentDayAccess" gorm:"comment:当日访问次数;default:0"`
	LastAccessDate   time.Time `json:"lastAccessDate" gorm:"comment:最后访问日期" time_format:"2006-01-02 15:04:05"`
	TotalAccessLimit int       `json:"totalAccessLimit" gorm:"comment:总访问限制次数;default:10000"`
	TotalAccess      int       `json:"totalAccess" gorm:"comment:总访问次数;default:0"`
}

// TableName 设置表名
func (UUIDLicense) TableName() string {
	return "uuid_licenses"
}

// UUIDExportData 包含续费信息的UUID导出数据
type UUIDExportData struct {
	UUIDLicense
	RenewalCount     int       `json:"renewalCount"`     // 总续费次数
	TotalRenewalDays int       `json:"totalRenewalDays"` // 总续费天数
	LastRenewalTime  time.Time `json:"lastRenewalTime"`  // 最近续费时间
}
